<?php
/**
 * FBA仓库设置
 * (model)
 */
namespace App\Models\Basics;

use Illuminate\Database\Eloquent\Model;
class FbaWarehouse extends Model
{
    protected $table = 'b_fba_warehouse';

    protected $guarded = [];

    public function country(){
        return $this->belongsTo(SysCountry::class,'country_id');
    }

    public static function getAddressIdByAddressCode($code,$countryId = null)
    {
        $query = self::query()->where('d_address_code',$code);
        if($countryId){
            $query = $query->where('country_id',$countryId);
        }
        return $query->value('d_address');
    }

}
